/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.muni.fi.pv168.reminder.swing.workers;

import cz.muni.fi.pv168.reminder.entities.Worker;
import cz.muni.fi.pv168.reminder.managers.WorkerManager;
import cz.muni.fi.pv168.reminder.managers.implementation.WorkerManagerImpl;
import cz.muni.fi.pv168.reminder.swing.FrameMainWindow;
import java.util.ArrayList;
import java.util.List;
import javax.swing.SwingWorker;

/**
 *
 * @author Adic
 */
public class LoadWorkersSwingWorker extends SwingWorker<List<Worker>, Void> {
    
    


    @Override
    protected List<Worker> doInBackground() throws Exception {
        List<Worker> workers = new ArrayList<>();
        WorkerManager workerManager = new WorkerManagerImpl();
        workerManager.setDataSource(FrameMainWindow.getDataSource());
        
        
            workers = workerManager.findAllPersons();
            return workers;
        
    }

    
}
    

